package cn.drenal.capcap.entity;

import cn.drenal.capcap.entity.base.BaseEntity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.tangzc.autotable.annotation.ColumnComment;
import com.tangzc.autotable.annotation.ColumnDefault;
import com.tangzc.autotable.annotation.ColumnNotNull;
import com.tangzc.mpe.autotable.annotation.*;
import com.tangzc.mpe.processer.annotation.AutoDefine;
import com.tangzc.mpe.processer.annotation.AutoMapper;
import com.tangzc.mpe.processer.annotation.AutoRepository;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.List;

/**
 * 作品表
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Table(comment = "作品表")
public class Artwork extends BaseEntity {
    @ColumnComment("主键")
    @ColumnId(mode = IdType.AUTO)
    private Long id;

    @ColumnComment("标题")
    @ColumnNotNull
    private String title;

    @ColumnComment("封面图片路径")
    private String coverImage;

    @ColumnComment("描述")
    @Column(length = 2000)
    private String description;

    @ColumnComment("分类ID")
    private Long categoryId;

    @ColumnComment("作者ID")
    @ColumnNotNull
    private Long userId;

    @ColumnComment("状态：0-草稿，1-审核中，2-已发布，3-已拒绝")
    @ColumnNotNull
    @ColumnDefault("0")
    private Integer status;

    @ColumnComment("拒绝原因")
    private String rejectReason;

    @ColumnComment("浏览量")
    @ColumnNotNull
    @ColumnDefault("0")
    private Integer viewCount;

    @ColumnComment("收藏数")
    @ColumnNotNull
    @ColumnDefault("0")
    private Integer favoriteCount;

    @ColumnComment("评论数")
    @ColumnNotNull
    @ColumnDefault("0")
    private Integer commentCount;

    @ColumnComment("活动ID")
    private Long activityId;
    
    @ColumnComment("是否参加活动：0-否，1-是")
    @ColumnNotNull
    @ColumnDefault("0")
    private Integer isActivity;
    
    /**
     * 标签列表，非数据库字段
     */
    @TableField(exist = false)
    private List<String> tags;
    
    /**
     * 图片列表，非数据库字段
     */
    @TableField(exist = false)
    private List<ArtworkImage> images;
}